package main

import (
	"fmt"
	"log"
	"net/http"
)

func ce(h http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		fmt.Println(r.URL.Path)
		h.ServeHTTP(w, r)
	})
}

// http.Dir函数讲解,
//FileServer返回一个使用FileSystem接口root提供文件访问服务的HTTP处理器。要使用操作系统的FileSystem接口实现，可使用http.Dir
func http_Dir() {
	//h := http.FileServer(http.Dir("./"))
	//http.ListenAndServe(":1789", ce(h))

	log.Fatal(http.ListenAndServe(":1789", http.FileServer(http.Dir("./"))))
}

func main() {
	http_Dir()
}
